<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>">
		<!--[if lte IE 6]></base><![endif]-->
		<title>广东科学技术职业学院考生报到系统<s:property value="%{#session.college.collegesName}"/></title>
		<link href="css/pagecss.css" rel="stylesheet" type="text/css" />
		<link href="css/newindex.css" rel="stylesheet" type="text/css" />
		<script src="js/jquery-1.5.js" language="javascript">
</script>
		<script src="js/newpublic.js" language="javascript">
</script>
		<script src="js/table.js" language="javascript">
</script>
		<script src="<%=request.getContextPath()%>/js/pageInfo.js"
			type="text/javascript">
		</script>
				<script src="js/jquery-ui-1.8.5.custom.min.js" language="javascript">
</script>
		<script language="javascript">
function zhuanf(ob) {
	if (ob.value != '0') {
		$(".zhtext").css('display', 'block');
	} else {
		$(".zhtext").css('display', 'none');
	}
}
$(function() {
	$("#content").draggable({cancel:".contable"});
	//动态加载logo
	$("#content .subjectlogo").css("background-image","url(<%=basePath%>/newimages/${sessionScope.college.collegeLogo})");
	
	//专业列表
	var list = '<s:property value="proJson" escape="false"/>';
	//取得上次查询的条件
	var data_profession = '<s:property value="dorm_profession" escape="false"/>';
	var data_classNO = '<s:property value="dorm_classNO"/>';
	var data_sex = '<s:property value="dorm_sex" escape="false"/>';
	var data_bedRestOprate = '<s:property value="dorm_bedRestOprate" escape="false"/>';
	var data_bedRest = '<s:property value="dorm_bedRest"/>';

	//转换为对象
	list = eval('(' + list + ')');
	for ( var a in list) {
		var temp = eval("list." + a);
		$("#dorm_profession").append(
				"<option value='" + a + "'>" + a + "</option>");
	}

	$('#dorm_profession').change(function() {
		if (this.options.selectedIndex == 0) {
			$('#dorm_classNO').empty();
			$("#dorm_classNO").append("<option value=''>全部班级</option>");
		} else
			dormClass_show($(this.options[this.options.selectedIndex]).val());
	})

	$('#dorm_bedRestOprate').change(function() {
		if (this.options.selectedIndex == 0) {
			$(".zhtext").css('display', 'none');
		} else {
			$(".zhtext").css('display', 'block');
		}
	})

	//选中上次查询所选中专业
	$("select#dorm_profession option").each(function() {
		if ($(this).val() == data_profession) {
			$(this).attr("selected", "selected");
			$('#dorm_profession').trigger("change")
			return;
		}
	});
	//选中上次查询所选中班级
	$("select#dorm_classNO option").each(function() {
		if ($(this).val() == data_classNO) {
			$(this).attr("selected", "selected");
			return;
		}
	});
	//选中上次查询所选中性别 
	$("select#dorm_sex option").each(function() {
		if ($(this).val() == data_sex) {
			$(this).attr("selected", "selected");
			return;
		}
	});
	//选中上次查询所选中床位条件
	$("select#dorm_bedRestOprate option").each(function() {
		if ($(this).val() == data_bedRestOprate) {
			$(this).attr("selected", "selected");
			$('#dorm_bedRestOprate').trigger("change");
			if (data_bedRestOprate != "")
				$('#dorm_bedRest').val(data_bedRest);
			else
				$('#dorm_bedRest').val("");
			return;
		}
	});

	$('#btn_dormSearch').click(function() {
		var dorm_bedRestOprate = $("#dorm_bedRestOprate").val();
		var dorm_bedRest = $("#dorm_bedRest").val();
		if (dorm_bedRestOprate == "") {
			$("#dorm_bedRest").val("");
		} else {
			var reg = /^[\d]{1,2}$/;
			if (!reg.test(dorm_bedRest)) {
				alert("输入格式错误, 请输入空床位数, 必须为整数!");
				return;
			}
		}
		$('#pageIndex').val(1);
		$('#my_form').submit();
	});

	function dormClass_show(obj) {
		var temp = eval("list." + obj);
		$('#dorm_classNO').empty();
		$("#dorm_classNO").append("<option value=''>全部班级</option>");
		for ( var i = 1; i <= parseInt(temp); i++) {
			$("#dorm_classNO").append(
					"<option value='" + i + "'>" + i + "</option>");
		}
	}
})
function abc(){
	initPage(${pageInfo.totalPage},${pageInfo.pageIndex},${pageInfo.pageSize},${pageInfo.totalRec})
	fixPNGAll()
}
</script>

	</head>
	<body
		onload="abc()">
		<jsp:include page="common_head.jsp" />
				<div id="content">
					<!--当前位置CSS-->
					<div class="top">
						<div class="topleft">
							<div class="dan">
								<div>
									当前位置>
									信息查询&gt;床位查询
								</div>
							</div>
							<div class="F5">
								<img src="newimages/F5.png" />
							</div>
						</div>
						<div class="topright">
							<div class="toprightmin"></div>
							<div class="toprightmax"></div>
							<div class="toprightclose" onclick="if(confirm('是否确定退出！')){location.replace('loginoutAction')}" title="点击退出"></div>
						</div>
					</div>
					<!---->
					<!--内容-->
					<div class="condiv">
						<div class="subjectlogo">
							<!--每学院Logo-->
							<div class="submenu">
								<ul>
									<li>
										<a href="queryAction!obtainAllData">综合查询</a>
									</li>
									<li>
										<a href="queryClassAction">班级查询</a>
									</li>
								</ul>
							</div>
							<div class="contable">
								<div class="contable">

									<!-- 表格，从数据库读数据 -->
									<div name="dd2" id="secon" class="dd3">
										<div class="title">
											床位查询
										</div>
										<div class="selecontent">

											<form action="queryAction!dormInfo" method="post"
												name="my_form" id="my_form">

												<s:hidden name="pageInfo.pageIndex" id="pageIndex" />
												<s:hidden name="pageInfo.pageSize" id="pageSize" />

												<table width="95%" border="0" cellspacing="5"
													cellpadding="1">
													<tr>
														<td width="8%" height="40" align="right">
															专业：
														</td>
														<td width="13%" align="left">
															<select id="dorm_profession" name="dorm_profession">
																<option value="">
																	全部专业
																</option>
															</select>
														</td>
														<td width="8%" align="right">
															班级：
														</td>
														<td width="13%" align="left">
															<select id="dorm_classNO" name="dorm_classNO">
																<option value="">
																	全部班级
																</option>
															</select>
														</td>
														<td width="8%" align="right">
															性别：
														</td>
														<td width="10%" align="left">
															<select name="dorm_sex" id="dorm_sex">
																<option value="all">
																	全部
																</option>
																<option value="male">
																	男
																</option>
																<option value="female">
																	女
																</option>
															</select>
														</td>
														<td width="15%" align="right">
															空床位数：
														</td>
														<td width="25%" align="left">
															<table>
																<tr>
																	<td>
																		<select name="dorm_bedRestOprate"
																			id="dorm_bedRestOprate">
																			<option value="">
																				不限
																			</option>
																			<option value=">">
																				大于
																			</option>
																			<option value="=">
																				等于
																			</option>
																			<option value="&lt">
																				小于
																			</option>
																		</select>
																	</td>
																	<td>
																		<input type="text" size="4" style="display: none;"
																			class="zhtext" name="dorm_bedRest" id="dorm_bedRest" />
																	</td>
																</tr>
															</table>
														</td>
														<td width="7%">
															<input type="button" id="btn_dormSearch" value="查找" />
														</td>
													</tr>
												</table>
											</form>
										</div>
										<div id="date" class="date1">

											<Div id="data" style="" class="date1">
												<span style="color: #F00; font-size: 16px;">查询结果：</span>

												<table width="100%" border="0" align="center"
													cellpadding="1" cellspacing="1" class="t1"
													style="border: 1px solid #5cb0ff;">
													<tr style="background-color: #90c9ff;">
														<th align="center">
															宿舍号
														</th>
														<th align="center">
															性别
														</th>
														<th align="center">
															入住学生
														</th>
														<th align="center">
															专业
														</th>
														<th align="center">
															班级
														</th>
														<th align="center">
															空床位数
														</th>
													</tr>
													<s:iterator value="dormInfoList" var="list">
														<tr>
															<td align="center">
																<s:property value="dormNumber" />
															</td>
															<td align="center">
																<s:if test="#list.sex == true">男</s:if>
																<s:else>女</s:else>
															</td>
															<td align="center">
																<s:iterator value="studentList">
																	<s:property value="studentName" />&nbsp;
												</s:iterator>
															</td>
															<td align="center">
																<s:property value="profession" />
															</td>
															<td align="center">
																<s:property value="clazz" />
															</td>
															<td align="center">
																<s:property value="bedRest" />
															</td>
														</tr>
													</s:iterator>
													<tr>
														<td align="center">
															&nbsp;
														</td>
														<td align="center">
															&nbsp;
														</td>
														<td align="center">
															&nbsp;
														</td>
														<td align="center">
															&nbsp;
														</td>
														<td align="center">
															&nbsp;
														</td>
														<td align="center">
															&nbsp;
														</td>
													</tr>
													<!--<tr>
											<td colspan="6" align="right">
												<span id="AllPage">显示共几页，共几条</span>
												<span id="setupNum">显示每页记录条数</span>
												<span id="Flexigrid_Bar">显示页数</span>
											</td>
										</tr>
										<tr>
											<td colspan="6" align="right">
												<span id="checkPage">显示跳到第几页</span>
											</td>
										</tr>
									-->
												</table>
												<!--上一页，下一页 开始-->
												<table width="100%" class="pagecss">
													<tr>
														<td align="left">
															<span id="AllPage">共几页/几条</span>
															<span id="setupNum">显示每页记录条数</span>
														</td>
														<td align="right">
															<span id="Flexigrid_Bar"><a href="">上5页</a><span
																class="dan">1</span><a href="">2</a><a href="">3</a><a
																href="">下5页</a> </span>
															<span id="checkPage"><input type="text"
																	style="width: 20px;"> &nbsp;页<a href="">GO</a>
															</span>
														</td>
													</tr>
												</table>
												<!--上一页，下一页 结束-->
												<table width="100%">
													<tr>
														<td colspan="8" style="text-align: right;">
															<input type="button" value="导出" />
														</td>
													</tr>
												</table>
											</Div>
										</div>
									</div>
									<!-- 表格，从数据库读数据结束 -->
								</div>
							</div>
						</div>
					</div>
					<!---->

					<!---->
					<div class="condiv"
						style="width: 997px; position: relative; height: 20px; min-height: 20px; text-align: center;">
						<a href="computer/computer.html" target="_blank">计算机学院程序员之家</a>
					</div>
					<!---->

					<!--低部-->
					<div class="bottom">
						&nbsp;
					</div>
					<!---->
				</div>
			</div>
		</div>
		<s:form action="queryAction!dormInfo" id="pageForm" name="pageForm">
			<!--
			    	<s:hidden name="dorm_profession" />
			    	<s:hidden name="dorm_classNO" />
			    	<s:hidden name="dorm_sex" />
			    	<s:hidden name="dorm_bedRestOprate" />
			    	<s:hidden name="dorm_bedRest" />
    				-->
			<s:hidden name="pageInfo.pageIndex" id="pageIndex" />
			<s:hidden name="pageInfo.pageSize" id="pageSize" />
		</s:form>
	</body>
</html>
